//
//  SISSNetworkingManager+RentOutProgress.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/1/2.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSNetworkingManager+RentOutProgress.h"
#import "SISSTenantModel.h"
#import "SISSRentOutProgressRecordInfoModel.h"
#import "SISSLeaserEntrustContractModel.h"
#import "SISSHouseConditionInfoModel.h"
#import "SISSRentOutTakeLookAppointmentModel.h"
#import "SISSRentOutTakeLookModel.h"
#import "SISSCommentModel.h"
#import "SISSTenantInfoModel.h"
#import "SISSNetworkingManager+File.h"
#import "SISSHouseManualModel.h"

@implementation SISSNetworkingManager (RentOutProgress)

// 4.2.5 删除出租进度 GET请求
- (void)deleteRentOutProgressWithAlbpId:(NSString *)albpId successBlock:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"albpId":albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_DELETE_RENTOUT_PROGRESS parameters:parameters success:^(id responseObject) {
        NSLog(@"4.2.5 删除出租进度 GET请求: responseObject-->%@",responseObject);
        
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.4.5 获取出租进度的信息 GET请求
- (void)requestRentOutProgressRecordInfoWithAlbpId:(NSString *)albpId success:(void (^)(SISSRentOutProgressRecordInfoModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"albpId":albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_RENTOUT_PROGRESS_INFO parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.4.5 获取出租进度的信息 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        
        SISSRentOutProgressRecordInfoModel *model = [SISSRentOutProgressRecordInfoModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.23.3  获取出租推荐的租客信息 GET请求
- (void)requestRentOutRecommendTenantWithAlbpId:(NSString *)albpId success:(void (^)(SISSTenantModel *))successBlock failed:(void (^)(NSError *))failedBlock {

    NSDictionary *parameters = @{
                                 @"albpId":albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_RENTOUT_RECOMMEND_TENANT parameters:parameters success:^(id responseObject) {
        NSLog(@"4.23.3  获取出租推荐的租客信息 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        
        SISSTenantModel *model = [SISSTenantModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.29.3 添加出租方委托协议 (图文上传)
- (void)insertLeaserEntrustContractWithParameters:(NSDictionary *)parameters imagesArray:(NSArray *)imagesArray successBlock:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    [SISSPublicSingleton shared].isHud = NO;
    [kNetworkManager uploadFileListWatermark:imagesArray success:^(id  _Nonnull responseObject) {
        NSLog(@"%@",responseObject);
        if ([responseObject[@"code"] integerValue] == 200) {
            NSArray *dataArr = responseObject[@"data"];
            NSDictionary *parameter = @{
                                        @"saId":[SISSUserAccount shared].saId,
                                        @"file":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_LEASER_ENTRUST_CONTRACT parameters:params success:^(id responseObject) {
                NSLog(@"4.29.3 添加出租方委托协议: responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        }
    } failed:^(NSError * _Nonnull error) {
        NSLog(@"%@",error);
    }];
}

// 4.42.1 获取出租状况说明书列表 GET请求
- (void)requestRentOutProgressHouseStatusManualListAlrId:(NSString *)alrId success:(void (^)(NSArray<SISSHouseConditionInfoModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"alrId": alrId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_RENTOUT_STATUS_MANUAL_LIST parameters:parameters success:^(id responseObject) {
        NSLog(@"4.42.1 获取出租状况说明书列表 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataArr = responseObject[@"data"];
        NSArray *modelArr = [NSArray yy_modelArrayWithClass:[SISSHouseConditionInfoModel class] json:dataArr];
        if (successBlock) {
            successBlock(modelArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.42.2 添加出租房屋状况说明书 (图文上传)
- (void)insertRentOutLeaseManualInfoWithParameters:(NSDictionary *)parameters imagesArray:(NSArray<UIImage *> *)imagesArray houseImages:(NSArray<UIImage *> *)houseImages success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [SISSPublicSingleton shared].isHud = NO;
    // 创建信号量
    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
    // 创建全局并行
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_group_t group = dispatch_group_create();
    __block NSArray *fileArr = [NSArray array];
    dispatch_group_async(group, queue, ^{
        // 请求一
        [kNetworkManager uploadFileListWatermark:imagesArray success:^(id  _Nonnull responseObject) {
            NSLog(@"%@",responseObject);
            if ([responseObject[@"code"] integerValue] == 200) {
                fileArr = responseObject[@"data"];
                dispatch_semaphore_signal(semaphore);
            }
        } failed:^(NSError * _Nonnull error) {
            NSLog(@"%@",error);
        }];
    });
    __block NSArray *dataArr = [NSArray array];
    dispatch_group_async(group, queue, ^{
        // 请求二
        [kNetworkManager uploadFileListWatermark:houseImages success:^(id  _Nonnull responseObject) {
            NSLog(@"%@",responseObject);
            if ([responseObject[@"code"] integerValue] == 200) {
                dataArr = responseObject[@"data"];
                dispatch_semaphore_signal(semaphore);
            }
        } failed:^(NSError * _Nonnull error) {
            NSLog(@"%@",error);
        }];
    });
    dispatch_group_notify(group, queue, ^{
        // 两个请求对应两次信号等待
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
        
        //在这里 进行请求后的方法，回到主线程
        dispatch_async(dispatch_get_main_queue(), ^{
            if ([PublicUtil isBlankArr:fileArr]) return;
            if ([PublicUtil isBlankArr:dataArr]) return;
            NSDictionary *parameter = @{
                                        @"saId":[SISSUserAccount shared].saId,
                                        @"spId":[SISSUserAccount shared].spId,
                                        @"manual":fileArr,
                                        @"house":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            if ([SISSPublicSingleton shared].isHud == YES) [SISSPublicSingleton shared].isHud = NO;
            
            [kNetworkNoUTF8Manager POSTWithURLString:URL_PROGRESS_INSERT_RENTOUT_STATUS_MANUAL parameters:params success:^(id responseObject) {
                NSLog(@"4.42.2 添加出租房屋状况说明书 (图文上传): responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        });
    });
}

// 4.42.3 获取出租房屋状况说明书 GET请求
- (void)requestRentOutProgressLeaseManualWithId:(NSString *)ID success:(void (^)(SISSHouseManualModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    NSDictionary *parameters = @{
                                 @"id" : ID
                                 };
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_LEASE_MANUAL parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.42.3 获取出租房屋状况说明书 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        
        SISSHouseManualModel *houseManualModel = [SISSHouseManualModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(houseManualModel);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.42.4 更新出租房屋状况说明书 (图文上传) PUT请求
- (void)updateRentOutLeaseManualInfoWithParameters:(NSDictionary *)parameters imagesArray:(NSArray<UIImage *> *)imagesArray houseImages:(NSArray<UIImage *> *)houseImages success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [SISSPublicSingleton shared].isHud = NO;
    // 创建信号量
    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
    // 创建全局并行
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_group_t group = dispatch_group_create();
    __block NSArray *fileArr = [NSArray array];
    dispatch_group_async(group, queue, ^{
        // 请求一
        if (imagesArray.count > 0) {
            [kNetworkManager uploadFileListWatermark:imagesArray success:^(id  _Nonnull responseObject) {
                NSLog(@"%@",responseObject);
                if ([responseObject[@"code"] integerValue] == 200) {
                    fileArr = responseObject[@"data"];
                    dispatch_semaphore_signal(semaphore);
                }
            } failed:^(NSError * _Nonnull error) {
                NSLog(@"%@",error);
            }];
        } else {
            dispatch_semaphore_signal(semaphore);
        }
    });
    __block NSArray *dataArr = [NSArray array];
    dispatch_group_async(group, queue, ^{
        // 请求二
        if (houseImages.count > 0) {
            [kNetworkManager uploadFileListWatermark:houseImages success:^(id  _Nonnull responseObject) {
                NSLog(@"%@",responseObject);
                if ([responseObject[@"code"] integerValue] == 200) {
                    dataArr = responseObject[@"data"];
                    dispatch_semaphore_signal(semaphore);
                }
            } failed:^(NSError * _Nonnull error) {
                NSLog(@"%@",error);
            }];
        } else {
            dispatch_semaphore_signal(semaphore);
        }
    });
    dispatch_group_notify(group, queue, ^{
        // 两个请求对应两次信号等待
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
        dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
        
        //在这里 进行请求后的方法，回到主线程
        dispatch_async(dispatch_get_main_queue(), ^{
            NSDictionary *parameter = @{
                                        @"saId":[SISSUserAccount shared].saId,
                                        @"spId":[SISSUserAccount shared].spId,
                                        @"manual":fileArr,
                                        @"house":dataArr,
                                        };
            NSMutableDictionary *params = [NSMutableDictionary dictionaryWithDictionary:parameter];
            [params addEntriesFromDictionary:parameters];
            if ([SISSPublicSingleton shared].isHud == YES) [SISSPublicSingleton shared].isHud = NO;
            [kNetworkNoUTF8Manager PUTWithURLString:URL_PROGRESS_UPDATE_RENTOUT_STATUS_MANUAL parameters:params success:^(id responseObject) {
                NSLog(@"4.42.4 更新出租房屋状况说明书 (图文上传) PUT请求: responseObject-->%@",responseObject);
                
                if (successBlock) {
                    successBlock(responseObject);
                }
            } failure:^(NSError *error) {
                if (failedBlock) {
                    failedBlock(error);
                }
            }];
        });
    });
}

// 4.43.1 获取出租进度带看预约记录 GET请求
- (void)requestRentOutTakelookAppointmentWithAlbpId:(NSString *)albpId success:(void (^)(NSArray<SISSRentOutTakeLookAppointmentModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"albpId": albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_RENTOUT_TAKELOOK_APPOINTMENT parameters:parameters success:^(id responseObject) {
        NSLog(@"4.43.1 获取出租进度带看预约记录 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *takelookArr = [NSArray yy_modelArrayWithClass:[SISSRentOutTakeLookAppointmentModel class] json:dataArr];
        if (successBlock) {
            successBlock(takelookArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.43.3 获取出租进度带看详情 GET请求
- (void)requestRentOutTakelookDetailWithLtlrId:(NSString *)ltlrId success:(void (^)(SISSRentOutTakeLookModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"ltlrId": ltlrId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_RENTOUT_TAKELOOK_DETAIL parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.43.3 获取出租进度带看详情 GET请求: responseObject-->%@",responseObject);
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        NSDictionary *dataDict = responseObject[@"data"];
        SISSRentOutTakeLookModel *takeLookDetail = [SISSRentOutTakeLookModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(takeLookDetail);
        }
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
    
}

// 4.43.6 获取出租进度带看记录 GET请求
- (void)requestRentOutTakelookRecordWithAlbpId:(NSString *)albpId success:(void (^)(NSArray<SISSRentOutTakeLookModel *> *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"albpId": albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_RENTOUT_TAKELOOK_RECORD parameters:parameters success:^(id responseObject) {
        NSLog(@"4.43.6 获取出租进度带看记录 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataArr = responseObject[@"data"];
        
        NSArray *takelookArr = [NSArray yy_modelArrayWithClass:[SISSRentOutTakeLookModel class] json:dataArr];
        if (successBlock) {
            successBlock(takelookArr);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.43.7  获取出租进度带看经纪人评价房东详情 GET请求
- (void)requestCommentTakeLookBrokerCommentLandlordInfoWithId:(NSString *)ID success:(void (^)(SISSCommentModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"id": ID
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TAKELOOK_BROKER_COMMENT_LANDLORD parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.43.7  获取出租进度带看经纪人评价房东详情 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataDict = responseObject[@"data"];
        SISSCommentModel *model = [SISSCommentModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}
// 4.43.8  获取出租进度带看房东评价经纪人详情 GET请求
- (void)requestCommentTakeLookLandlordCommentBrokerInfoWithId:(NSString *)ID success:(void (^)(SISSCommentModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"id": ID
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TAKELOOK_LANDLORD_COMMENT_BROKER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.43.8  获取出租进度带看房东评价经纪人详情 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataDict = responseObject[@"data"];
        
        SISSCommentModel *model = [SISSCommentModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.43.9  经纪人评价房东
- (void)insertBrokerCommentLandlordWithParameters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kNetworkManager POSTWithURLString:URL_PROGRESS_INSERT_BROKER_COMMENT_LANDLORD parameters:parameters success:^(id responseObject) {
        NSLog(@"4.43.9  经纪人评价房东: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}


// 4.50.1 获取出租进度经纪人评价房东 GET请求
- (void)requestCommentBrokerCommentLandlordInfoWithAlbpId:(NSString *)albpId success:(void (^)(SISSCommentModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"ltlrId":@"-1",
                                 @"albpId": albpId,
                                 @"comment_type":@(2)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_BROKER_COMMENT_LANDLORD parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.50.1 获取出租进度经纪人评价房东 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataDict = responseObject[@"data"];
        SISSCommentModel *model = [SISSCommentModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.50.2 获取出租进度房东评价经纪人 GET请求
- (void)requestCommentLandlordCommentBrokerInfoWithAlbpId:(NSString *)albpId success:(void (^)(SISSCommentModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"spId":[SISSUserAccount shared].spId,
                                 @"ltlrId":@"-1",
                                 @"albpId":albpId,
                                 @"comment_type":@(2)
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_LANDLORD_COMMENT_BROKER parameters:parameters success:^(id responseObject) {
        
        NSLog(@"4.50.2 获取出租进度房东评价经纪人 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSArray *dataDict = responseObject[@"data"];
        SISSCommentModel *model = [SISSCommentModel yy_modelWithJSON:dataDict];
        if (successBlock) {
            successBlock(model);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.44.1 设置交易租客 GET请求
- (void)confirmTradeTenantWithParameters:(NSDictionary *)parameters success:(void (^)(id))successBlock failed:(void (^)(NSError *))failedBlock {
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_BUYER_CONFIRM_TRADE_TENANT parameters:parameters success:^(id responseObject) {
        NSLog(@"4.44.1 设置交易租客 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        if (successBlock) {
            successBlock(responseObject);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}

// 4.44.2 获取交易房源 GET请求
- (void)requestTradeTenatInfoWithAlbpId:(NSString *)albpId success:(void (^)(SISSTenantModel *))successBlock failed:(void (^)(NSError *))failedBlock {
    
    NSDictionary *parameters = @{
                                 @"albpId":albpId
                                 };
    
    [kNetworkManager GETWithURLString:URL_PROGRESS_GET_TRADE_TENANT parameters:parameters success:^(id responseObject) {
        NSLog(@"4.44.2 获取交易房源 GET请求: responseObject-->%@",responseObject);
        
        if ([responseObject[@"code"] integerValue] != 200) {
            
            NSLog(@"%@",responseObject[@"data"]);
        }
        
        NSDictionary *dataDict = responseObject[@"data"];
        SISSTenantModel *tenantInfo = [SISSTenantModel yy_modelWithJSON:dataDict];
        
        if (successBlock) {
            successBlock(tenantInfo);
        }
        
    } failure:^(NSError *error) {
        
        if (failedBlock) {
            failedBlock(error);
        }
    }];
}


@end
